Skip to content

feat: implement bytemuck for plugin header loading #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

VolodymyrBg
Copy link

feat: implement bytemuck for plugin header loading

Description:
This PR implements bytemuck for safer type punning when loading plugin headers. Changes include:

  • Added bytemuck::Pod and bytemuck::Zeroable implementations for PluginHeaderV1 and Key
  • Added InvalidPluginHeader error variant to handle bytemuck conversion failures
  • Updated plugin header loading in utils.rs to use bytemuck instead of manual loading
  • Improved type safety by using compile-time checked type punning

The changes make the code safer by using bytemuck's compile-time checked type punning instead of manual loading, which helps prevent potential memory safety issues.

Copy link

vercel bot commented Jan 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mpl-core-js-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2025 10:58am

@VolodymyrBg
Copy link
Author

@blockiosaurus
Copy link
Contributor

I don't believe this works because the alignment of the Plugin Header cannot be guaranteed. Additionally I'm not sure there's much benefit to using zero copy on only 9 bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants